/*
 * @Descripttion: js
 * @Version: 1.0
 * @Author: name
 * @Date: 2021-03-03 20:03:20
 * @LastEditors: name
 * @LastEditTime: 2021-03-03 22:44:29
 */
const path = require("path");
// vite.config.js # or vite.config.ts

function resolve(dir) {
  return path.join(__dirname, dir);
}

// process.env.VUE_APP_BASE_URL = "http://admin.anquan119.net"
// console.log(process.env.VUE_APP_BASE_URL);

module.exports = {
  port: "9528",
  publicPath: "/",
  assetsDir: "static",
  outputDir: "dist",
  lintOnSave: false,
  devServer: {
    host: "0.0.0.0",
    hot: true,
    open: true,
    noInfo: false,
    overlay: {
      warnings: false,
      errors: true,
    },
    proxy: {
      // 商城
      "/shop": {
        target: "http://admin.anquan119.net",
        changeOrigin: true,
      },
      "/supplier": {
        target: "http://admin.anquan119.net",
        changeOrigin: true,
      },
    },
  },
  parallel: false,
  pluginOptions: {
    "style-resources-loader": {
      preProcessor: "less",
      patterns: [
        // 'E:\\gmn\\apfc\\public\\iview-theme\\index.less'
        resolve("./src/stylus/index.less"),
      ],
    },
  },
  alias: {
    // 键必须以斜线开始和结束
    "/@/": resolve("./src"),
    "/@api/": resolve("./src/api"),
    "/@assets/": resolve("./src/assets"),
    "/@cpms/": resolve("./src/components"),
    "/@config/": resolve("./src/config"),
    "/@router/": resolve("./src/router"),
    "/@store/": resolve("./src/store"),
    "/@views/": resolve("./src/views"),
    "/@utils/": resolve("./src/utils"),
    "/@plugins/": resolve("./src/plugins"),
  },
};
